function init() {
	tinyMCEPopup.resizeToInnerSize();
}

function insertVideoCode()
{
var lvRegx = /(.*)/i;
urltype = document.forms[0].type.value;
url = document.forms[0].url.value;

	if ( url == "" )
	{
	window.alert( "The URL you entered is not valid!" );
	return false;
	}
	
    result = lvRegx.exec(url);

	if (result)
	{
	insertFlash(result[1],urltype);
	return true;
	}
	

return false;
}

function insertFlash( vidID, urlType )
{
	if (urlType=="localhost")
	{
	    vidID = escape(vidID);
        html = '<object height="355" width="425" codebase="http:\/\/download.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=6,0,40,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">\n'
		+'  <param name="src" value="client/swf/player.swf" \/>\n'
		+'  <param name="flashvars" value="videoUrl='+ vidID + '" \/>\n'
		+'  <embed type="application\/x-shockwave-flash" width="425" height="355" src="client/swf/player.swf?videoUrl='+ vidID + '"><\/embed>\n'
		+'<\/object>';
	}
	if (urlType=="youtube")
	{
		html = url;
	}
	tinyMCEPopup.execCommand("mceInsertContent", false, html);
	tinyMCE.selectedInstance.repaint();
	tinyMCEPopup.close();
}